package com.subnext.model;

import static com.subnext.utils.EntityUtil.getLongProperty;
import static com.subnext.utils.EntityUtil.getStringProperty;
import static com.subnext.utils.EntityUtil.setProperty;

import com.google.appengine.api.datastore.Entity;

public class CategoryEntity extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	
	private Long parentId;
	private String name;
	
	public Long getParentId() {
		return parentId;
	}
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public void save(Entity entity) {
		super.save(entity);
		setProperty(entity, "name", name, false);
		setProperty(entity, "parentId", parentId, true);
	}
	
	@Override
	public void load(Entity entity) {
		super.load(entity);
		name = getStringProperty(entity, "name");
		parentId = getLongProperty(entity, "parentId");
	}
	
	
}